{include file="public/layout" /}
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 
	<span class="c-gray en">&gt;</span> 管理员管理 
	<span class="c-gray en">&gt;</span> 管理员列表 
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i>
	</a>
</nav>
<div class="page-container">
	<form class="navbar-form form-inline" action="{url:('/Admin/admin/index')}" method="get">
	<div class="text-c"> 日期范围：
		<input type="text" onfocus="WdatePicker()" id="datemin" class="input-text Wdate" style="width:120px;" name="start_time">
		-
		<input type="text" onfocus="WdatePicker()" id="datemax" class="input-text Wdate" style="width:120px;" name="end_time">
		<input type="text" class="input-text" style="width:250px" placeholder="输入管理员名称" name="keywords">
		<button type="submit" class="btn btn-success" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜管理员</button>
	</div>
    </form>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a> <a href="/Admin/admin/admin_info" class="btn btn-primary radius"><i class="Hui-iconfont">&#xe600;</i> 添加管理员</a></span> <span class="r">共有数据：<strong>{$count}</strong> 条</span> </div>
	<table class="table table-border table-bordered table-bg">
		<thead>
			<tr>
				<th scope="col" colspan="9">管理员列表</th>
			</tr>
			<tr class="text-c">
				<th width="25"><input type="checkbox"></th>
				<th width="40">ID</th>
				<th width="150">登录名</th>
				<th width="90">所属角色</th>
				<th width="150">Email地址</th>
				<th width="130">加入时间</th>
				<th width="100">操作</th>
			</tr>
		</thead>
		<tbody>
			{volist name="list" id="vo" key="k" }
			<tr class="text-c">
				<td><input type="checkbox" value="{$vo.admin_id}" class="checkboxId"></td>
				<td>{$vo.admin_id}</td>
				<td>{$vo.user_name}</td>
				<td>{$vo.role}</td>
				<td>{$vo.email}</td>
				<td>{$vo.add_time}</td>
				<td class="td-manage">
					<a title="编辑" href="/Admin/admin/admin_info?admin_id={$vo.admin_id}" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6df;</i></a> 
					<a title="删除" href="javascript:;" onclick="admin_del(this)" data-url="/Admin/Admin/adminHandle" data-id="{$vo.admin_id}" class="ml-5" style="text-decoration:none"><i class="Hui-iconfont">&#xe6e2;</i></a>
				</td>
			</tr>
			{/volist}
		</tbody>
	</table>
</div>
{include file="public/footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/public/h-ui.admin/lib/My97DatePicker/4.8/WdatePicker.js"></script> 
<script type="text/javascript" src="/public/h-ui.admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="/public/h-ui.admin/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
/*管理员-删除*/
function admin_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: $(obj).attr('data-url'),
			data : {act:'del',admin_id:$(obj).attr('data-id')},
			dataType: 'json',
			success: function(data){
				$(obj).parents("tr").remove();
				layer.msg('已删除!',{icon:1,time:1000});
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}

//批量删除
function datadel() {
		var ids = '';
		var len = $(".checkboxId").length;
		for(var i = 0; i < len; i++) {
			var status = $(".checkboxId").eq(i).prop("checked");
			if(status == true) {
				var checkval = 1;
				ids+= ','+$(".checkboxId").eq(i).val();
			}
		}

		//至少选择一项目
		if(checkval == 1) {
			var ids = ids.substring(1);
			layer.confirm('确认要删除吗？',function(index){
				$.ajax({
						type: 'POST',
						url: '/Admin/admin/delAll',
						data : {act:'delAll',ids:ids},
						dataType: 'json',
						success: function(data){
							layer.msg('已删除!',{icon:1,time:1000});
							setTimeout(function(){window.location.reload();}, 2000);
						},
						error:function(data) {
							console.log(data.msg);
						},
				});		
			});
		} else {
			layer.msg('至少选择一项目!',{icon:2,time:1000});
		}
	}
</script>
</body>
</html>